﻿using SportsPlatform.BaseModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SportsPlatform.Model.SportBusiness
{
    /// <summary>
    /// 计划任务实体模型
    /// </summary>
    [Table("T_B_SysScheduleJob")]
    public class SysScheduleJob : BaseModel
    {
        /// <summary>
        /// 任务名称
        /// </summary>
        public String JobName { get; set; }

        /// <summary>
        /// 任务描述
        /// </summary>
        public String JobDescription { get; set; }

        /// <summary>
        /// 命名空间
        /// </summary>
        public String NameSpace { get; set; }

        /// <summary>
        /// 实现类
        /// </summary>
        public String JobImplement { get; set; }

        /// <summary>
        /// Cron表达式
        /// </summary>
        public String CronExpression { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public Nullable<DateTime> StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public Nullable<DateTime> EndTime { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        public JobStatus JobStatus { get; set; }

        /// <summary>
        /// 集群编号
        /// </summary>
        public Nullable<int> GroupId { get; set; }

        /// <summary>
        /// 序号
        /// </summary>
        public Nullable<int> SerialNumber { get; set; }
    }
    /// <summary>
    /// 任务状态
    /// </summary>
    public enum JobStatus
    {
        [Description("已启用")]
        Started,

        [Description("运行中")]
        Running,

        [Description("执行中")]
        Executing,

        [Description("执行完成")]
        Completed,

        [Description("任务计划中")]
        Planning,

        [Description("已停止")]
        Stopped
    }
}
